#ifndef __GWBIND_HPP__
#define __GWBIND_HPP__

#include "gwcommon.h"
#include "gwnulltype.h"

/**
*@file       gwbind.hpp
*@brief      functor bind class.through the bind function of loki and boost has been little slick, I implement my own.
*            as you see gwBindImpl class use specialize technique to instead "list" technique like gwTemplateParamHelper.
*            "list" technique basally use recursive template as well, this make full use of template's power but also get
*            some disadvantages. recursive template always be the result of recursive inherit case.so the call of constructor
*            from one to many. this makes it inefficient to small object like the gwBindImpl class and so on.
*
*@author     graywind
*@version    1.0.0.0
*@data       2012/01/06
*/

/**
//
        author     :    grayWind
                date       :    2010-5-22
                filename   :    gwBind.hpp
                NOTE       :

*/

namespace gwBedrockUtil
{
        template<class R>
        class gwBindFunctor;

        template<class R>
        class gwBind;
}

namespace gwBedrockUtil
{
        template<class R>
        class gwBindFunctor
        {
        public:
                virtual  ~gwBindFunctor(){};
                virtual  R    operator()() = 0;
        };

        //---------------------------------------------------------------------------------------------------------------------------

        template<class R, typename F, class Param1 = gwNullType, class Param2 = gwNullType, class Param3 = gwNullType,
                                      class Param4 = gwNullType, class Param5 = gwNullType, class Param6 = gwNullType,
                                                      class Param7 = gwNullType, class Param8 = gwNullType, class Param9 = gwNullType,
                                                      class Param10 = gwNullType, class Param11 = gwNullType, class Param12 = gwNullType,
                                                      class Param13 = gwNullType, class Param14 = gwNullType, class Param15 = gwNullType>
    class gwBindImpl;

        template<class R,typename F>
        class gwBindImpl<R,F, gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                              gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;
        public:
                gwBindImpl(F _f) : f(_f){}

                R operator()()
                {
                        return f();
                }
        };

        template<class R,typename F,class Param1>
        class gwBindImpl<R,F, Param1,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
        public:
                gwBindImpl(F _f, Param1 _param1) : f(_f),param1(_param1){}

                R operator()()
                {
                        return f(param1);
                }
        };

        template<class R,typename F,class Param1,class Param2>
        class gwBindImpl<R,F, Param1,Param2,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2) : f(_f),param1(_param1),param2(_param2){}

                R operator()()
                {
                        return f(param1,param2);
                }
        };


        template<class R,typename F,class Param1,class Param2,class Param3>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3) : f(_f),param1(_param1),param2(_param2),param3(_param3){}

                R operator()()
                {
                        return f(param1,param2,param3);
                }
        };


        template<class R,typename F,class Param1,class Param2,class Param3,
                                    class Param4>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                                  Param4,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                         param4(_param4){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4);
                }
        };


        template<class R,typename F,class Param1,class Param2,class Param3,
                                    class Param4,class Param5>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                                  Param4,Param5,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
                Param5      param5;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4, Param5 _param5) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                                             param4(_param4),param5(_param5){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4,param5);
                }
        };


        template<class R,typename F,class Param1,class Param2,class Param3,
                                    class Param4,class Param5,class Param6>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                                  Param4,Param5,Param6,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
                Param5      param5;
                Param6      param6;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4, Param5 _param5, Param6 _param6) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                                                             param4(_param4),param5(_param5),param6(_param6){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4,param5,param6);
                }
        };


        template<class R,typename F,class Param1,class Param2,class Param3,
                                    class Param4,class Param5,class Param6,
                                    class Param7>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                                  Param4,Param5,Param6,
                                  Param7,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
                Param5      param5;
                Param6      param6;
                Param7      param7;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4, Param5 _param5, Param6 _param6,
                                     Param7 _param7) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                             param4(_param4),param5(_param5),param6(_param6),
                                                         param7(_param7){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4,param5,param6,
                                         param7);
                }
        };

        template<class R,typename F,class Param1,class Param2,class Param3,
        class Param4,class Param5,class Param6,
        class Param7,class Param8>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                                  Param4,Param5,Param6,
                                  Param7,Param8,gwNullType,
                                  gwNullType,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
                Param5      param5;
                Param6      param6;
                Param7      param7;
                Param8      param8;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4, Param5 _param5, Param6 _param6,
                                     Param7 _param7, Param8 _param8) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                                             param4(_param4),param5(_param5),param6(_param6),
                                                                             param7(_param7),param8(_param8){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4,param5,param6,
                                     param7,param8);
                }
        };

        template<class R,typename F,class Param1,class Param2,class Param3,
        class Param4,class Param5,class Param6,
        class Param7,class Param8,class Param9>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                Param4,Param5,Param6,
                Param7,Param8,Param9,
                gwNullType,gwNullType,gwNullType,
                gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
                Param5      param5;
                Param6      param6;
                Param7      param7;
                Param8      param8;
                Param9      param9;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4, Param5 _param5, Param6 _param6,
                                     Param7 _param7, Param8 _param8, Param9 _param9) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                                                             param4(_param4),param5(_param5),param6(_param6),
                                                                                             param7(_param7),param8(_param8),param9(_param9){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4,param5,param6,
                                     param7,param8,param9);
                }
        };


        template<class R,typename F,class Param1,class Param2,class Param3,
                                    class Param4,class Param5,class Param6,
                                    class Param7,class Param8,class Param9,
                                    class Param10>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                                  Param4,Param5,Param6,
                                  Param7,Param8,Param9,
                                  Param10,gwNullType,gwNullType,
                                  gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
                Param5      param5;
                Param6      param6;
                Param7      param7;
                Param8      param8;
                Param9      param9;
                Param10     param10;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4, Param5 _param5, Param6 _param6,
                                     Param7 _param7, Param8 _param8, Param9 _param9,
                                     Param10 _param10) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                               param4(_param4),param5(_param5),param6(_param6),
                                                               param7(_param7),param8(_param8),param9(_param9),
                                                           param10(_param10){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4,param5,param6,
                                     param7,param8,param9,
                                     param10);
                }
        };


        template<class R,typename F,class Param1,class Param2,class Param3,
                                    class Param4,class Param5,class Param6,
                                    class Param7,class Param8,class Param9,
                                    class Param10,class Param11>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                                  Param4,Param5,Param6,
                                  Param7,Param8,Param9,
                                  Param10,Param11,gwNullType,
                                  gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
                Param5      param5;
                Param6      param6;
                Param7      param7;
                Param8      param8;
                Param9      param9;
                Param10     param10;
                Param11     param11;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4, Param5 _param5, Param6 _param6,
                                     Param7 _param7, Param8 _param8, Param9 _param9,
                                     Param10 _param10, Param11 _param11) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                                                 param4(_param4),param5(_param5),param6(_param6),
                                                                                 param7(_param7),param8(_param8),param9(_param9),
                                                                                 param10(_param10),param11(_param11){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4,param5,param6,
                                     param7,param8,param9,
                                     param10,param11);
                }
        };


        template<class R,typename F,class Param1,class Param2,class Param3,
                                    class Param4,class Param5,class Param6,
                                    class Param7,class Param8,class Param9,
                                    class Param10,class Param11,class Param12>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                                  Param4,Param5,Param6,
                                  Param7,Param8,Param9,
                                  Param10,Param11,Param12,
                                  gwNullType,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
                Param5      param5;
                Param6      param6;
                Param7      param7;
                Param8      param8;
                Param9      param9;
                Param10     param10;
                Param11     param11;
                Param12     param12;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4, Param5 _param5, Param6 _param6,
                                     Param7 _param7, Param8 _param8, Param9 _param9,
                                     Param10 _param10, Param11 _param11, Param12 _param12) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                                                                   param4(_param4),param5(_param5),param6(_param6),
                                                                                                   param7(_param7),param8(_param8),param9(_param9),
                                                                                                   param10(_param10),param11(_param11),param12(_param12){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4,param5,param6,
                                     param7,param8,param9,
                                     param10,param11,param12);
                }
        };


        template<class R,typename F,class Param1,class Param2,class Param3,
                                    class Param4,class Param5,class Param6,
                                    class Param7,class Param8,class Param9,
                                    class Param10,class Param11,class Param12,
                                    class Param13>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                                  Param4,Param5,Param6,
                                  Param7,Param8,Param9,
                                  Param10,Param11,Param12,
                                  Param13,gwNullType,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
                Param5      param5;
                Param6      param6;
                Param7      param7;
                Param8      param8;
                Param9      param9;
                Param10     param10;
                Param11     param11;
                Param12     param12;
                Param13     param13;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4, Param5 _param5, Param6 _param6,
                                     Param7 _param7, Param8 _param8, Param9 _param9,
                                     Param10 _param10, Param11 _param11, Param12 _param12,
                                     Param13 _param13) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                               param4(_param4),param5(_param5),param6(_param6),
                                                               param7(_param7),param8(_param8),param9(_param9),
                                                               param10(_param10),param11(_param11),param12(_param12),
                                                           param13(_param13){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4,param5,param6,
                                     param7,param8,param9,
                                     param10,param11,param12,
                                     param13);
                }
        };

        template<class R,typename F,class Param1,class Param2,class Param3,
                                    class Param4,class Param5,class Param6,
                                    class Param7,class Param8,class Param9,
                                    class Param10,class Param11,class Param12,
                                    class Param13,class Param14>
        class gwBindImpl<R,F, Param1,Param2,Param3,
                                  Param4,Param5,Param6,
                                  Param7,Param8,Param9,
                                  Param10,Param11,Param12,
                                  Param13,Param14,gwNullType> : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
                Param5      param5;
                Param6      param6;
                Param7      param7;
                Param8      param8;
                Param9      param9;
                Param10     param10;
                Param11     param11;
                Param12     param12;
                Param13     param13;
                Param14     param14;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4, Param5 _param5, Param6 _param6,
                                     Param7 _param7, Param8 _param8, Param9 _param9,
                                     Param10 _param10, Param11 _param11, Param12 _param12,
                                     Param13 _param13, Param14 _param14) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                                                 param4(_param4),param5(_param5),param6(_param6),
                                                                                 param7(_param7),param8(_param8),param9(_param9),
                                                                                 param10(_param10),param11(_param11),param12(_param12),
                                                                                 param13(_param13),param14(_param14){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4,param5,param6,
                                     param7,param8,param9,
                                     param10,param11,param12,
                                     param13,param14);
                }
        };

        template<class R,typename F,class Param1,class Param2,class Param3,
                                    class Param4,class Param5,class Param6,
                                    class Param7,class Param8,class Param9,
                                    class Param10,class Param11,class Param12,
                                    class Param13,class Param14,class Param15>
        class gwBindImpl : public gwBindFunctor<R>
        {
        private:
                F           f;

                Param1      param1;
                Param2      param2;
                Param3      param3;
                Param4      param4;
                Param5      param5;
                Param6      param6;
                Param7      param7;
                Param8      param8;
                Param9      param9;
                Param10     param10;
                Param11     param11;
                Param12     param12;
                Param13     param13;
                Param14     param14;
                Param15     param15;
        public:
                gwBindImpl(F _f, Param1 _param1, Param2 _param2, Param3 _param3,
                                     Param4 _param4, Param5 _param5, Param6 _param6,
                                     Param7 _param7, Param8 _param8, Param9 _param9,
                                     Param10 _param10, Param11 _param11, Param12 _param12,
                                     Param13 _param13, Param14 _param14, Param15 _param15) : f(_f),param1(_param1),param2(_param2),param3(_param3),
                                                                                                   param4(_param4),param5(_param5),param6(_param6),
                                                                                                   param7(_param7),param8(_param8),param9(_param9),
                                                                                                   param10(_param10),param11(_param11),param12(_param12),
                                                                                                   param13(_param13),param14(_param14),param15(_param15){}

                R operator()()
                {
                        return f(param1,param2,param3,
                                     param4,param5,param6,
                                     param7,param8,param9,
                                     param10,param11,param12,
                                     param13,param14,param15);
                }
        };

        //----------------------------------------------------------------------------------------------------------------------

        template<class R>
        class gwBind : public gwBindFunctor<R>
        {
        public:
                typedef   R     gwResultType;

        private:
                gwBindFunctor<R>*        m_func;

        public:
                template<class FuncPtr>
                gwBind(FuncPtr f) : m_func(new gwBindImpl<R,FuncPtr>(f))
                {

                }

                template<class FuncPtr, class param1>
                gwBind(FuncPtr f, param1 p1) : m_func(new gwBindImpl<R,FuncPtr,param1>(f,p1))
                {

                }

                template<class FuncPtr, class param1, class param2>
                gwBind(FuncPtr f, param1 p1,param2 p2) : m_func(new gwBindImpl<R,FuncPtr,param1,param2>(f,p1,p2))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3>
                 gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3) : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3>(f,p1,p2,p3))
                 {

                 }

                template<class FuncPtr, class param1, class param2, class param3, class param4>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                                      param4 p4)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                                   param4>(f,p1,p2,p3,p4))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3, class param4, class param5>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                        param4 p4, param5 p5)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                    param4,param5>(f,p1,p2,p3,p4,p5))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3, class param4, class param5, class param6>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                        param4 p4, param5 p5, param6 p6)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                               param4,param5,param6>(f,p1,p2,p3,p4,p5,p6))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3, class param4, class param5, class param6, class param7>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                                      param4 p4, param5 p5, param6 p6,
                                      param7 p7)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                       param4,param5,param6,
                                                                                                   param7>(f,p1,p2,p3,p4,p5,p6,p7))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3, class param4, class param5, class param6, class param7, class param8>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                                      param4 p4, param5 p5, param6 p6,
                                                  param7 p7, param8 p8)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                                              param4,param5,param6,
                                                                                                              param7,param8>(f,p1,p2,p3,p4,p5,p6,p7,p8))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3, class param4, class param5, class param6, class param7, class param8, class param9>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                                      param4 p4, param5 p5, param6 p6,
                                                  param7 p7, param8 p8, param9 p9)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                                                         param4,param5,param6,
                                                                                                                         param7,param8,param9>(f,p1,p2,p3,p4,p5,p6,p7,p8,p9))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3, class param4, class param5, class param6, class param7, class param8, class param9,
                                        class param10>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                                      param4 p4, param5 p5, param6 p6,
                                      param7 p7, param8 p8, param9 p9,
                                                  param10 p10)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                                     param4,param5,param6,
                                                                                                     param7,param8,param9,
                                                                                                     param10>(f,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3, class param4, class param5, class param6, class param7, class param8, class param9,
                                        class param10, class param11>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                                      param4 p4, param5 p5, param6 p6,
                                      param7 p7, param8 p8, param9 p9,
                                                  param10 p10, param11 p11)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                                                  param4,param5,param6,
                                                                                                                  param7,param8,param9,
                                                                                                                  param10,param11>(f,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3, class param4, class param5, class param6, class param7, class param8, class param9,
                                        class param10, class param11, class param12>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                                      param4 p4, param5 p5, param6 p6,
                                      param7 p7, param8 p8, param9 p9,
                                                  param10 p10, param11 p11, param12 p12)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                                                               param4,param5,param6,
                                                                                                                               param7,param8,param9,
                                                                                                                               param10,param11,param12>(f,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3, class param4, class param5, class param6, class param7, class param8, class param9,
                                        class param10, class param11, class param12, class param13>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                                      param4 p4, param5 p5, param6 p6,
                                      param7 p7, param8 p8, param9 p9,
                                      param10 p10, param11 p11, param12 p12,
                                                  param13 p13)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                              param4,param5,param6,
                                                                                              param7,param8,param9,
                                                                                              param10,param11,param12,
                                                                                              param13>(f,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3, class param4, class param5, class param6, class param7, class param8, class param9,
                                        class param10, class param11, class param12, class param13, class param14>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                                      param4 p4, param5 p5, param6 p6,
                                      param7 p7, param8 p8, param9 p9,
                                      param10 p10, param11 p11, param12 p12,
                                      param13 p13, param14 p14)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                                                  param4,param5,param6,
                                                                                                                  param7,param8,param9,
                                                                                                                  param10,param11,param12,
                                                                                                                  param13,param14>(f,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14))
                {

                }

                template<class FuncPtr, class param1, class param2, class param3, class param4, class param5, class param6, class param7, class param8, class param9,
                                        class param10, class param11, class param12, class param13, class param14, class param15>
                gwBind(FuncPtr f, param1 p1, param2 p2, param3 p3,
                                      param4 p4, param5 p5, param6 p6,
                                      param7 p7, param8 p8, param9 p9,
                                      param10 p10, param11 p11, param12 p12,
                                      param13 p13, param14 p14, param15 p15)  : m_func(new gwBindImpl<R,FuncPtr,param1,param2,param3,
                                                                                                                param4,param5,param6,
                                                                                                                param7,param8,param9,
                                                                                                                param10,param11,param12,
                                                                                                                param13,param14,param15>(f,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15))
                {

                }


                ~gwBind()
                {
                        gw_delete(m_func);
                }


                R     operator()()
                {
                        return (*m_func)();
                }
        };
}

#endif
